/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.trade;

import com.enation.app.javashop.core.client.feignimpl.trade.OrderOperateClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import com.enation.app.javashop.model.trade.cart.dos.OrderPermission;
import com.enation.app.javashop.model.trade.order.dos.OrderDO;
import com.enation.app.javashop.model.trade.order.dos.OrderLogDO;
import com.enation.app.javashop.model.trade.order.dos.OrderOutStatus;
import com.enation.app.javashop.model.trade.order.dos.TransactionRecord;
import com.enation.app.javashop.model.trade.order.enums.OrderOutStatusEnum;
import com.enation.app.javashop.model.trade.order.enums.OrderOutTypeEnum;
import com.enation.app.javashop.model.trade.order.enums.OrderServiceStatusEnum;
import com.enation.app.javashop.model.trade.order.vo.CancelVO;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 订单Operate熔断
 *
 * @author fk
 * @version v7.2
 * @date 20/4/17 下午3:15
 * @since v7.0
 */
@Component
public class OrderOperateClientFallbackFactory extends BaseFallbackFactory<OrderOperateClientFeignImpl> implements FallbackFactory {


    @Override
    protected OrderOperateClientFeignImpl fallback() {
        return new OrderOperateClientFallback();
    }

    /**
     * 订单Operate熔断
     *
     * @author fk
     * @version v7.2
     * @date 20/4/17 下午3:15
     * @since v7.0
     */
    @Component
    public static class OrderOperateClientFallback implements OrderOperateClientFeignImpl {

        protected final Log logger = LogFactory.getLog(this.getClass());

        @Override
        public void updateItemJson(String itemsJson, String orderSn) {
            logger.error("更新订单项异常");
        }

        @Override
        public void addGoodsSnapshot(OrderDO orderDO) {
            logger.error("添加交易快照异常");
        }

        @Override
        public void editOrderShopName(Long shopId, String shopName) {
            logger.error("更新订单的店铺名称异常");
        }

        @Override
        public void cancel(CancelVO cancelVO, OrderPermission permission) {
            logger.error("订单取消异常");
        }

        @Override
        public void updateServiceStatus(String orderSn, OrderServiceStatusEnum serviceStatus) {
            logger.error("更新订单的售后状态异常");
        }

        @Override
        public void editOutStatus(String orderSn, OrderOutTypeEnum typeEnum, OrderOutStatusEnum statusEnum) {
            logger.error("修改订单出库状态异常");
        }

        @Override
        public TransactionRecord addTransactionRecord(TransactionRecord transactionRecord) {
            logger.error("添加交易记录表异常");
            return null;
        }

        @Override
        public void paySuccess(String tradeType, String subSn, String returnTradeNo, Double payPrice) {
            logger.error("paySuccess异常");
        }

        @Override
        public void add(OrderOutStatus orderOutStatus) {
            logger.error("add异常");
        }

        @Override
        public void addOrderLog(OrderLogDO logDO) {
            logger.error("addOrderLog异常");
        }
    }
}
